﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MensUnoShop.Models.ViewModels.CartViewModel>" %>
<%@ Import Namespace="MensUnoShop.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	men'suno SHOP
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
    GetResponse('<%:TempData["alert"]??""%>');
</script>
<div class="CART_CONTENT">
<img src="/Content/page_img/cart_content_top.gif" />
<div class="CART_TITLE">
<h1>購物車</h1>
<span class="CART_BT_FAVORITE"><a href="/member/my_favorite">最愛商品清單</a></span>
<br class="CLEAR" />
</div>
<div class="CART_FORM">
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="114"><div align="center"></div></td>
    <td width="97"><div align="center"></div></td>
    <td width="394"><div align="left">商品<br />
        Item</div></td>
    <td><div align="center">顏色<br />Color</div></td>
    <td width="54"><div align="center">單價<br />
        Price</div></td>
    <td width="34"><div align="center">數量<br />
        Quantity</div></td>
    <td width="64"><div align="center">金額小計<br />
        Total price</div></td>
    <td width="52"><div align="center">刪除<br />
        Delete</div></td>
  </tr>

  <% foreach(var sc in Model.CART.MLIST.Where(m=>m.TYPE!=Config.MarketType.Combo)){ %>
  <tr>
    <td>
    <div align="center">
    <input type="hidden" id="mguid_<%:sc.MKGUID %>" name="mguid_<%:sc.MKGUID %>" value="<%:Model.MEMBER!=null?Model.MEMBER.MGUID:Guid.Empty %>" />
    <input type="hidden" id="mkguid_<%:sc.MKGUID %>"  name="mkguid_<%:sc.MKGUID %>" value="<%:sc.MKGUID %>" />
    <input type="hidden" id="productid_<%:sc.MKGUID %>" name="productid_<%:sc.MKGUID %>" value="<%:MensUnoShop.Models.MarketFactory.GetProductId(sc.SPECID) %>" />
    <input type="hidden" id="specid_<%:sc.MKGUID %>" name="specid_<%:sc.MKGUID %>" value="<%:sc.SPECID %>" />    
    <input type="button" name="addmf" id="addmf" value="Add to favorite" onclick="javascript:addmyfavorite2('<%:sc.MKGUID %>');" />
    <%--<a href="#" id="addmyfavorite" name="addmyfavorite" class="addmyfavorite" onclick="javascript:addmyfavorite2('<%:sc.MKGUID %>')">加入最愛清單</a>--%>
    </div>
    </td>
    <td><div align="center"><img src="<%:sc.IMG %>" width="75" height="75" /></div></td>
    <td valign="top"><%:sc.SN %><br /><%:sc.TITLE %><br />
      <span class="PRODUCT3_HOT_POINT"><%:sc.DISCOUNTNOTE %></span></td>
    <td><div align="center"><%:sc.COLOR %></div></td>
    <td><div align="center">NT$<%:sc.SINGLEPRICE %></div></td>
    <td><div align="center"><form action="" name="form_<%:sc.SN %>" method="post"><input type="hidden" name="utype" value="setamount" /><input type="hidden" name="mokguid" value="<%:sc.MOKGUID %>" /><input name="values" type="text" value="<%:sc.AMOUNT %>" size="2" onkeyup="if($(this).val()!=''){this.form.submit();}" /></form></div></td>
    <td><div align="center">NT$<%:sc.PRICE %></div></td>
    <td><div align="center"><form action="" method="post"><input type="hidden" name="utype" value="del" /><input type="hidden" name="mokguid" value="<%:sc.MOKGUID %>" /><input type="button" value="Delete" onclick="if(confirm('確定刪除?')){this.form.submit();}" /></form></div></td>
  </tr>
  <%} %>
  <% foreach(var sc in Model.CART.MLIST.Where(m=>m.TYPE==Config.MarketType.Combo).GroupBy(m=>m.COMBOID)){
         int i = 0;
         int pices = sc.Count();
         int divv = pices/sc.FirstOrDefault().AMOUNT;
         foreach (var s in sc)
         {
             string cs = string.Empty;
             string cs1 = string.Empty;
             string single = string.Empty;
             string amount = string.Empty;
             string total = string.Empty;
             string del = string.Empty;

             if (i != sc.Count() - 1)
             {
                 cs = "style=\"border-bottom:none;\"";
                 cs1 = "style=\"border-bottom:none;\"";
             }
             if ((i+1)%divv==0)
             {
                 cs = "style=\"border-bottom:none;\"";
                 cs1 = string.Empty;
             }
             if (i == 0)
             {
                 single = "NT$"+s.SINGLEPRICE.ToString();
                 amount = s.AMOUNT.ToString();
                 total = "NT$"+s.PRICE.ToString();
                 del = "<form action=\"\" method=\"post\"><input type=\"hidden\" name=\"utype\" value=\"del\" />";
                 del+= "<input type=\"hidden\" name=\"mokguid\" value=\""+s.MOKGUID+"\" />";
                 del += "<input type=\"button\" value=\"Delete\" onclick=\"if(confirm('確定刪除?')){this.form.submit();}\" /></form></div>";
             }
             else
             {
                 single = string.Empty;
                 amount = string.Empty;
                 total = string.Empty;
                 del = string.Empty;
             }
  %>
  <tr>
    <td <%=cs %>>
    </td>
    <td <%=cs1 %>><div align="center"><img src="<%:s.IMG %>" width="75" height="75" /></div></td>
    <td <%=cs1 %> valign="top"><%:s.SN%><br /><%:s.TITLE%><br />
      <span class="PRODUCT3_HOT_POINT"><%:s.DISCOUNTNOTE%></span></td>
    <td <%=cs1 %>><div align="center"><%:s.COLOR%></div></td>
    <td <%=cs %>><div align="center"><%:single%></div></td>
    <td <%=cs %>><div align="center"><%:amount%></div></td>
    <td <%=cs %>><div align="center"><%:total%></div></td>
    <td <%=cs %>><div align="center"><%=del %></div></td>
  </tr>
  <%
             i++;
         }
     } %>
</table>
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#CCCCCC">&nbsp;</td>
    <td bgcolor="#CCCCCC"><div align="right"><span class="FORM_TOTAL2">總計金額Total</span></div></td>
    <td width="120" bgcolor="#CCCCCC"><div align="left" class="FORM_TOTAL2">NT$<%:Model.CART.TOTAL %></div></td>
  </tr>
</table>

    <div class="CART_BOTTOM_BT">
      <form action="/order/f1/<%:Model.CART.SCGUID %>" method="post">
        <input type="button" value="繼續購物 Keep shopping" onclick="history.back();" />
        <input type="submit" name="button" id="button" value="送出訂單 Send" />
      </form>
    </div>
    <h2>退換貨說明</h2>
      <p>1.付款前請先確認訂單內商品細節（顏色、尺寸、數量）是否正確。<br />
      　Please kindly confirm detailed info like item, color, size and other special requirements with us before your payment.</p>
      <p>2. 產品顏色會因網頁呈現而有些許差異，產品規格若敘述有誤，以收到實品為準。<br />
        　Colors of merchandise may be a bit different on the website because of different monitors. <br />
      </p>
      <p>3.寄送時間：完成付款後3-5個工作天內到貨(例假日除外)，寄送到國外地區、預購、特殊商品除外。假日恕不提供寄送服務。 <br />
        　Normal order will be arrived within 3-5 business days after it ships (not including pre-sale or special order). WE DO NOT SHIP OR DELIVER <br />
        　ON WEEKENDS OR HOLIDAYS.</p>
      <p>4.依據台灣消保法(http://www.cpc.gov.tw/)，消費者均享有商品到貨7天鑑賞期之權益，收到商品（含當天）7天內可接受退貨，台灣地區本公司提供<br />
        　免費到府收件服務；非台灣地區需自付退回郵資。　 <br />
      　According to regulations of consumer protection act in Taiwan(http://www.cpc.gov.tw/),　all consumers of men’s uno shop are entitled to a <br />
　hesitant period for seven days. Therefore, we can not accept your returns more than seven days after you receive your order . Your order will be <br />
　returned by our appointed express, you will not need to pay the shipping costs for your return (*Only for Taiwan area); You will need to pay the <br />
　shipping costs for your return when you mail your package which is not in TAIWAN.</p>
    </div>
<br class="CLEAR" />
<img src="/Content/page_img/cart_content_bottom.gif" /></div>


</asp:Content>
